﻿// JavaScript Document

$(function () {


    var swiper = new Swiper('.honorscroll02', {
        pagination: '',
        nextButton: '.honorright',
        prevButton: '.honorleft',
        paginationClickable: true,
        slidesPerView: 3,
        spaceBetween: 20,
        breakpoints: {
            1024: {
                slidesPerView: 3,
                spaceBetween: 20
            },
            768: {
                slidesPerView: 2,
                spaceBetween: 10
            },
            640: {
                slidesPerView: 1,
                spaceBetween: 10
            },
            320: {
                slidesPerView: 1,
                spaceBetween: 10
            }
        }
    });


})

$(function () {

    positioncont();
    $(window).resize(function () {
        positioncont();
    });

    function positioncont() {

        var overflowwid = $("body").css("overflow", "hidden").width();
        var windowwid = $("body").removeAttr("style").width();
        var scrollwid = overflowwid - windowwid;

        if (windowwid + scrollwid > 767) {
            var contwid = $(".floatposition").outerWidth();
            var conthe = $(".floatposition").outerHeight();

            $(".floatposition").css({ "margin-left": -contwid / 2, "margin-top": -conthe / 2 });
        }
        else {
            $(".floatposition").css({ "margin-left": "auto", "margin-top": "auto" });


        }

    };

    $(".showcontactimg").click(function () {
        $(".contact03float").fadeIn();
        $(".floatposition").fadeIn();
        positioncont();
    });
    $(".contact03float").click(function () {
        $(".floatposition").fadeOut();
        $(this).fadeOut();
    });


})


//--------top01 start--------

$(function () {


    var bauiduShare = '<script>window._bd_share_config = { "common": { "bdSnsKey": {}, "bdText": "", "bdMini": "2", "bdMiniList": false, "bdPic": "", "bdStyle": "0", "bdSize": "16" }, "share": {} }; with (document) 0[(getElementsByTagName(\'head\')[0] || body).appendChild(createElement(\'script\')).src = \'http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion=\' + ~(-new Date() / 36e5)];</script>';
    $("body").append(bauiduShare);

    

    headernav1();
    $(window).resize(function () {
        headernav1();
    });


})

function headernav1() {

    //-------- 搜索 ---------
    $(".searchicon01").unbind("click").bind("click", function () {
        if ($(".searchwrap01").is(":hidden")) {
            $(".searchfloat01").show();
            $(".searchwrap01").fadeIn();
            $(".relatedlinks01").hide();
            $(".topshare01").hide();
            $(".showphonenav01").removeClass("closenav");
        }
        else {
            $(".searchfloat01").hide();
            $(".searchwrap01").fadeOut();
        }

    });

    //-------- 相关链接 --------
    $(".linkicon01").unbind("click").bind("click", function () {

        if ($(".relatedlinks01").is(":hidden")) {
            $(".searchfloat01").show();
            $(".relatedlinks01").fadeIn();
            $(".topshare01").fadeOut();
            $(".searchwrap01").fadeOut();
        }
        else {
            $(".searchfloat01").hide();
            $(".relatedlinks01").fadeOut();
        }
    });

    //-------- 头部分享 --------
    $(".shareicon01").unbind("click").bind("click", function () {

        if ($(".topshare01").is(":hidden")) {
            $(".searchfloat01").show();
            $(".topshare01").fadeIn();
            $(".relatedlinks01").fadeOut();
            $(".searchwrap01").fadeOut();
        }
        else {
            $(".searchfloat01").hide();
            $(".topshare01").fadeOut();
        }
    });


    $(".searchfloat01").click(function () {
        $(this).hide();
        $(".searchwrap01").fadeOut();
        $(".relatedlinks01").fadeOut();
        $(".topshare01").fadeOut();
    });

    var overflowwid = $("body").css("overflow", "hidden").width();
    var windowwid = $("body").removeAttr("style").width();
    var scrollwid = overflowwid - windowwid;

    if ($(".showphonenav01").hasClass("closenav")) {
        $(".showphonenav01").removeClass("closenav");
    };


    if (windowwid + scrollwid > 991) {

        $(".headernav01").css("height", "auto");

        $(".showphonenav01").unbind("click");
        $(".closelink01").unbind("click");
        $(".closeshare01").unbind("click");
        $(".headernav01").show();

        $(".subnavcont").hide();
        $(".phsearch").hide();
        $(".headernav01 ul li").unbind("mouseenter").bind("mouseenter", function () {
            $(this).find(".subnavcont").stop(true, true).fadeIn();
        });

        $(".headernav01 ul li").unbind("mouseleave").bind("mouseleave", function () {
            $(this).find(".subnavcont").stop(true, true).fadeOut();
        });


    }
    else {

        $(".headernav01").css("height", $(window).height());
        $(".headernav01").hide();
        $(".headernav01 ul li").unbind("mouseenter");
        $(".headernav01 ul li").unbind("mouseleave");
        $(".showphonenav01").unbind("click").bind("click", function () {
            if ($(".headernav01").is(":hidden")) {
                $(this).addClass("closenav");
                $(".searchfloat01").show();
                $(".headernav01").show();
                $(".searchwrap01").hide();
            }
            else {
                $(this).removeClass("closenav");
                $(".searchfloat01").hide();
                $(".headernav01").hide();
                $(".relatedlinks01").hide();
                $(".topshare01").hide();
                $(".searchwrap01").hide();
            }

        });
        $(".phsearchicon").unbind("click").bind("click", function () {
            if ($(this).parent().find(".subnavcont").is(":hidden")) {
                $(this).parent().find(".subnavcont").slideDown().parent().siblings().find(".subnavcont").slideUp();
            }
            else {
                $(this).parent().find(".subnavcont").slideUp();
            }

        });

        //-------- 相关链接 分享 --------
        $(".closelink01").unbind("click").bind("click", function () {

            $(".relatedlinks01").fadeOut();

        });

        $(".closeshare01").unbind("click").bind("click", function () {

            $(".topshare01").fadeOut();

        });


    };

};

//--------top01 end--------

$(function () {

    headernav2();
    $(window).resize(function () {
        headernav2();
    });

    function headernav2() {

        var overflowwid = $("body").css("overflow", "hidden").width();
        var windowwid = $("body").removeAttr("style").width();
        var scrollwid = overflowwid - windowwid;

        if (windowwid + scrollwid > 767) {

            $(".zsannavbtn02").unbind();
            $(".subnavlist02 .commonweb").show();
        }
        else {
            $(".subnavlist02 .commonweb").hide();
            $(".zsannavbtn02").unbind().bind("click", function () {
                if ($(".subnavlist02 .commonweb").is(":hidden")) {
                    $(".subnavlist02 .commonweb").stop(true, true).slideDown(300);
                }
                else {
                    $(".subnavlist02 .commonweb").stop(true, true).slideUp(300);
                }

            });
        };



    }


})


$(function () {

    // 动态加载js脚本文件
    function loadScript(url, callback) {
        var script = document.createElement("script");
        script.type = "text/javascript";
        script.src = url;
        document.body.appendChild(script);

        if (arguments.length == 2) {
            script.onload = function () {
                callback();
            }
        }

    }

    if (location.href.indexOf('/edit/') > -1 || location.href.indexOf('/add/') > -1) {

    } else {
        loadScript("/SysRes/plugin/laypage/laypage.js", function () {
            laypage({
                cont: 'data-page', //容器。值支持id名、原生dom对象，jquery对象,
                pages: all_page, //总页数
                groups: 0, //连续分数数0
                prev: false, //不显示上一页
                next: '查看更多',
                skin: 'flow', //设置信息流模式的样式
                jump: function (obj) {
                    if (obj.curr == all_page - 1) {
                        //this.next = '没有更多了';
                        this.next = '';
                        if (all_page > 2) {
                            $.get(channelPath + "index/" + obj.curr + ".html", function (r) {
                                $(".data-page-cont").append(($(r).find(".data-page-cont").html()));
                            })
                        }
                    }
                    else {
                        //2017.06.29  张浩修改，判断如果页面只有1页的时候，不需要脚本加载代码
                        if (obj.curr > 1 && all_page > 1) {
                            $.get(channelPath + "index/" + obj.curr + ".html", function (r) {
                                $(".data-page-cont").append(($(r).find(".data-page-cont").html()));
                            })
                        }
                    }
                }
            });
        });
    }
});

